<?php
/**
 * polwebgis
 * 
 * This file is part of polwebgis.
 *
 * @copyright   Copyright (c) 2012 Dominik Janisch (http://www.joanneum.at)
 * @lastmodified    $LastChangedDate: 2012-03-07 09:15:12 +0000 (Wed, 07 Mar 2012) $
 * @revision    $Revision: 160 $ 
 */

class Tags
{
    private $table_gateway_;

    public function __construct(TagsGateway $table_gateway)
    {
        $this->table_gateway_ = $table_gateway;
    }
    
    public function __destruct(){}
    
    public function getTagNameById($tag_id)
    {
        $tag_id = (int)$tag_id;
        if($tag_id < 1)
            return false;
        return $this->table_gateway_->getTagNameById($tag_id);
    }
    
    public function getAllTagsByFamily()
    {
        $arr_tags = $this->table_gateway_->getTagsByParentId(0);
        foreach($arr_tags as $key => $value)
            $arr_tags[$key]['children'] = $this->table_gateway_->getTagsByParentId($value['tag_id']);
        return $arr_tags;
    }
    
    public function getTagCategories()
    {
        return $this->table_gateway_->getTagsByParentId(0);
    }
}
?>
